﻿@{
    ViewData["Title"] = "Edit";
    List<Ace.Entity.Wiki.Sort> ListSort = ViewBag.ListSort as List<Ace.Entity.Wiki.Sort>;
    Ace.Entity.Wiki.News NewsModle = ViewBag.NewsModle as Ace.Entity.Wiki.News;
}
<script charset="utf-8" src="/Content/kindeditor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/Content/kindeditor/lang/zh-CN.js"></script>
@this.RefStyle("~/Content/webuploader/webuploader.css")
@this.RefScript("~/Content/webuploader/webuploader.js")
<style type="text/css">
    #picker { 
        line-height:20px;
        vertical-align: middle;
        margin: 0 0px 0 0;
    }
</style>

<div class="container">
    <div class="row">
        <form class="form-horizontal col-md-12" method="post" action="/Wiki/News/Edit"> 
            <fieldset>
                <div id="legend" class="">
                    <legend class="">意见内容</legend>
                </div>

                <input type="hidden" class="form-control" value="@NewsModle.Id" id="Id" name="Id">
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon" id="basic-addon1">反馈主题</span>
                        <input type="text" class="form-control" value="@NewsModle.Title" id="Title" name="Title" aria-describedby="basic-addon1">
                    </div>
                </div>

                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon" id="basic-addon2">意见分类</span>
                        <select class="form-control" id="SortID" name="SortID">
                            @foreach (var item in ListSort)
                            {
                                if (NewsModle.SortID == item.Id)
                                {
                                    <option selected value="@item.Id">@item.Title</option>
                                }
                                else
                                {
                                    <option value="@item.Id">@item.Title</option>
                                }

                            }

                        </select>

                    </div>
                </div>

                <div class="form-group" style="display:none;">
                    <div class="input-group">
                        <span class="input-group-addon">图片上传</span>
                        <input id="ImageUrl" name="ImageUrl" value="@NewsModle.ImageUrl" type="text" class="form-control" aria-label="Amount (to the nearest dollar)" style="height: 59px;">
                        <span class="input-group-addon" id="picker">选择文件</span>
                    </div>
                </div>

                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon" id="basic-addon3">手机号码</span>
                        <input type="text" class="form-control" value="@NewsModle.LinkUrl" id="LinkUrl" name="LinkUrl" aria-describedby="basic-addon3">
                    </div>
                </div>

                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon" id="basic-addon4">反馈内容</span>
                        <input type="text" class="form-control" value="@NewsModle.Summary" id="Summary" name="Summary" aria-describedby="basic-addon3">
                        
                    </div>
                </div>

                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon" id="basic-addon4">反馈状态</span>
                        @if (NewsModle.IsValid == 1)
                        {
                        <select name="IsValid" class="form-control" >
                            <option value="1" selected="selected">已回复</option>
                            <option value="0">未回复</option>
                        </select>
                        }
                        else
                        {
                        <select name="IsValid" class="form-control">
                            <option value="1">已回复</option>
                            <option value="0" selected="selected">未回复</option>
                        </select>
                        }
                    </div>
                </div>

                <div class="form-group">
                    <label for="inputfile">回复内容</label>
                    <textarea id="Contents" name="Contents" style="width:100%;height:300px;">
                     @NewsModle.Contents
                    </textarea>
                </div>


                <div class="form-group">
                    <input type="submit" value="提交" class="btn btn-primary" />
                    <input type="button" value="返回" class="btn btn-info"  onclick="window.history.back(-1);"/>
                </div>

            </fieldset>
        </form>

    </div>



</div>
<script>
    KindEditor.ready(function (K) {
        window.editor = K.create('#Contents', {
            uploadJson: '/KindEditor/SaveFiles',
            fileManagerJson: '/KindEditor/FileManager',
            allowFileManager: true
        });
    });

    var uploader = WebUploader.create({
        auto: true,
        swf: '/Content/webuploader/Uploader.swf',
        server: '/KindEditor/SaveFiles',
        pick: '#picker',
        resize: false
    });

    uploader.on('uploadSuccess', function (file, response) {
        var json = jQuery.parseJSON(response._raw);
        if (response.error == '0')
        {            
            $("#ImageUrl").val(response.url);
            
        }
        else
        {
            var msg = "上传失败，文件数据无法正确解析";
            $ace.alert(msg);
        }
    });
</script>


